package voidgame.core;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;

import javax.swing.JPanel;

public class RadarPanel extends JPanel{
	
	Game game;
	
	public RadarPanel(Game g){
		
		game=g;
		this.setBackground(Color.BLACK);
		this.setForeground(Color.GREEN);
		
	}
	
	public void paint(Graphics g) {
		
		super.paint(g);
		
       Graphics2D g2d = (Graphics2D) g;
       
       Font font = new Font("Lucida Console", Font.PLAIN, 14);
       g2d.setFont(font);

       g2d.drawString("RADAR PANEL", 20, 10);
       
       int[] offset={20,20};
       
       for(int x=0;x<game.MAPSIZEX;x++){
       		for(int y=0;y<game.MAPSIZEY;y++){
       			//g2d.fi
       			Cell cell = game.player.starSystem.map[x][y];
       			switch(cell.type){
       				case 0:g2d.setColor(Color.GREEN);break;
       				case 1:g2d.setColor(Color.YELLOW);break;
       				case 2:g2d.setColor(Color.BLUE);break;
       				case 3:g2d.setColor(Color.GREEN);break;
       				case 4:g2d.setColor(Color.MAGENTA);break;
       			}
       			if(game.player.pos[0]==x&&game.player.pos[1]==y)
       				g2d.setColor(Color.RED);
       			g2d.fillRect(offset[0]+x*3, offset[1]+y*3, 3, 3);
       			
       		}
       }
       
      
       
   }
	
}